﻿if (typeof Sotipha == "undefined") Sotipha = {};
if (typeof Sotipha.View == "undefined") Sotipha.View = {};
Sotipha.View.Cart = {}

$(function () {
    //$(".forminput").hide();
    $("#btnClose").val(ServerData.btnClose);
    $('.confirm').click(function () {
        //$(".forminput").slideToggle();
        $('.trSuccessful,#btnClose').hide();
        $('.trInfo,#btnSave').show();
        $('#div1').removeClass('show');
        $('#div2').removeClass('show');
        return false;
    });

    $('.closebtn,#btnClose').click(function () {
        $('#div1').addClass('show');
        $('#div2').addClass('show');
    });

    $('.btncontinuashopping').click(function () {
        history.go(-1);
        return false;
    });
});
function SaveOrder() {
    var pData = { CustomerName: $("#txtName").val(), Phone:$("#txtPhone").val(), Address:$("#txtAddress").val(), Email:$("#txtEmail").val()};   
   //var pData = $.string.Format("CustomerName={0}&Phone={1}&Address={2}&Email={3}", $("#txtName").val(), $("#txtPhone").val(), $("#txtAddress").val(), $("#txtEmail").val()) + "}";
   // var pData = { CustomerName=$("#txtName").val(), Phone: $("#txtPhone").val(), Address: $("#txtAddress").val(), Email: $("#txtEmail").val() };

    $.ajax({
        url: 'Service/OrderServer.asmx/SaveOrder',
        type: 'POST',
        data: pData,
        cache: false,
        // contentType: "application/json; charset=utf-8",
        // dataType: "json",
        success: function (data, textStatus, jqXHR) {
            data = $(data).find("string").text();
            var mas = eval("(" + data+ ")");
            if (mas.IsSuccessfull == true) {
                $('.trSuccessful,#btnClose').show();
                $('.trInfo,#btnSave').hide();
                
            }
            //overlay.Hide();
        },
        beforeSend: function (jqXHR, settings) {
            //
            // overlay.Show();
            $(".question").hide();

        },
        error: function (jqXHR, textStatus, errorThrown) {
            //overlay.Hide();
        },
        complete: function (XMLHttpRequest, textStatus) {
            //overlay.Hide();
        }
    });
}